package easy.trace.agent;

import easy.trace.agent.plugin.AgentBuilder;

import java.lang.instrument.Instrumentation;

/**
 *  JVM 综述                      https://www.jianshu.com/p/70154dc5a9ff
 *  深入浅出 JVM ClassLoader            https://www.jianshu.com/p/85eba062b9c1
 *  探秘 Java 热部署                 https://www.jianshu.com/p/731bc8293365
 *  探秘 Java 热部署二（Java agent premain）        https://www.cnblogs.com/stateis0/p/9062199.html
 *
 *
 * @author easy
 */
public class Bootstrap {


    /**
     * agentArgs是premain函数得到的程序参数，通过– javaagent命令行参数传入。
     * @param agentArgs
     * @param instrumentation
     */
    public static void premain(String agentArgs, Instrumentation instrumentation) {
        System.out.println("--------------- start premain  ---------------");
        instrumentation.addTransformer(new AgentBuilder().Default(), true);
        //instrumentation.addTransformer(new SimClassFileTransformer());
        System.out.println("--------------- end premain ---------------");
    }

}
